import { onMounted } from "vue";

export function useTimeout(fn: () => void, wait: number) {
    const timer = setTimeout(() => {
        fn()
    }, wait)

    const clear = () => {
        clearTimeout(timer)
    }

    onMounted(clear)
    return clear
}